package fast_fourier_transform;

/**
 * author :  apurv verma
 * email  :  dapurv5@gmail.com
 */


/*
 * UTILITY: Can be used to multiply two polynomials or even numbers in nlogn time complexity.
 */

public class MAIN {
	
	//USAGE

	public static void main(String args[]){
		
		//1. CREATE AN INSTANCE OF FastFourierTransform class.
		FastFourierTransform f=new FastFourierTransform();
		
		//2. STORE THE FFT OF POLYNOMIALS IN ARRAYS Fa[] and Fb[].
		Complex Fa[]=f.FFT(new double[]{1,2,3} );  //This represents the polynomial 1+2.x+3.x^2
		Complex Fb[]=f.FFT(new double[]{2,1,4} );  //This represents the polynomial 2+1.x+4.x^2
		
		//displaying Fa[]
		for(int i=0;i<Fa.length;i++){
			Fa[i].display();
			System.out.println();
		}
		
		
		Complex Fab[]=f.multiply(Fa,Fb);
		
		//3. a[] STORES THE COEFFICIENTS OF THE PRODUCT POLYNOMIAL.
		double a[]=f.invFFT(Fab);
		for(double i: a){
			//System.out.println(i);
		}
	}
	
}
